package com.amit.hibernate;

import java.util.Date;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

public class Lab19AClent1 {

	public static void main(String[] args) {
		
		SessionFactory sessionfactory=CHibernateUtil.getfactory();
		Session session=sessionfactory.openSession();
		Transaction tx=session.beginTransaction();
		
		Order o1=new Order(2,new Double(200.0),new Date(),"New");
		session.save(o1);
		
		Order o2=new Order(3,new Double(300.0),new Date(),"New");
		session.save(o2);
		
		Order o3=new Order(4,new Double(400.0),new Date(),"New");
		session.save(o3);
		
		Customer cust=new Customer("amit","amit@gmail.com",new Date(),new Long(9999));
		session.save(cust);
		o1.setCustomer(cust);
		o2.setCustomer(cust);
		o3.setCustomer(cust);
		
		
		tx.commit();
		session.close();
		
	
	}

}
